<#include "../common/header.htm">
<div class="content-wrapper">
	<section class="content-header">
		<ol class="breadcrumb">
			<li><a href="${ctx}/">首页</a></li>
			<li class="active"><a href="#">工单查询</a></li>
		</ol>
	</section>
	<section class="content">
		<div class="box">
		  <form action="${ctx}/workformlist/queryall">
			<div class="box-header">
				<div class="row RowSearchWork">
					<div class="col-sm-12">
						<div class="col-sm-2">
							<label>类型：</label> 
							<select class="form-control" name="businessType">
							   <option value="">请选择</option>
							   <#list businessTypeMap as key, value>
								   <#if params.businessType?exists && key == params.businessType>
										<option value="${key}" selected="selected">${value}</option>
									<#else>
										<option value="${key}">${value}</option>
									</#if>    
							   </#list>
							 </select>
						</div>
						<div class="col-sm-2">
							<label>工单状态：</label> 
							<select class="form-control" name="workFormStatus">
							   <option value="">请选择</option>
							   <#list workFormStatus as key, value>
								   <#if params.workFormStatus?exists && key == params.workFormStatus>
										<option value="${key}" selected="selected">${value}</option>
									<#else>
										<option value="${key}">${value}</option>
									</#if>    
							   </#list>
							 </select>
						</div>
						<div class="col-sm-2 three-word">
							<label>申请人：</label> 
							<input name="originator" type="text" class="form-control" placeholder="请输入发起人" value="${params.originator!}"/>
						</div>
						<div class="col-sm-2 width20">
							<label>客户经理：</label> 
							<input name="customerManager" type="text" class="form-control" placeholder="请输入客户经理" value="${params.customerManager!}"/>
						</div>
						<div class="col-sm-2 three-word width20">
							<label>关键字：</label> 
							<input name="keyword" type="text" class="form-control" placeholder="请输入编号/标题" value="${params.keyword!}"/>
						</div>
					</div>
				</div>
				<div class="row RowSearchWork">
					<div class="col-sm-8">
						<div class="col-sm-4" style="display: -webkit-box;">
							<label>申请日期：</label> 
			                <div class="input-group">
			                 	<input type="text" class="form-control" name="starTime" value="${params.starTime!}" id="starTime" autocomplete="off">
			                	<div class="input-group-addon">
			                    	<i>-</i>
			                  	</div>
			                 	<input type="text" class="form-control" name="endTime" value="${params.endTime!}" id="endTime" autocomplete="off">
			                </div>
						</div>
						<div class="col-sm-1 ml60">
							<input type="button" class="btn btn-default btn-search" id="query" value="查询" />
						</div>
					</div>
				</div>
			</div>
			<div class="box-body">
				<table class="table table-hover table-bordered table-striped table-hide">
					<thead>
						<tr>
							<th>序号</th>
							<th>标题</th>
							<th>类型</th>
							<th>申请人</th>
							<th>计费</th>
							<th>期限（月）</th>
							<th>线路</th>
							<th>并发</th>
							<th>申请时间</th>
							<th>客户经理</th>
							<th>进度</th>
							<th>工单状态</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<#list page.content as w>
						<tr>
							<td>${page.size*page.number+w_index+1}</td>
							<td title="${w.title!}">${w.title!}</td>
							<#if w.businessType?? && businessTypeMap["${w.businessType}"]?? >
								<td>${businessTypeMap["${w.businessType}"]!}</td>
							<#else>
								<td></td>
							</#if>
							<td>${w.createrName!}</td>
							<td>
								<#if w.clearingForm?? && clearingFormMap["${w.clearingForm}"]?? >
									${clearingFormMap["${w.clearingForm}"]!}
								<#else>
									--
								</#if>
							</td>
							<td>${w.clearingFormMonths!"--"}</td>
							<td>${w.lineNum!"--"}</td>
							<td>${w.concurrentNum!"--"}</td>
							<td>${w.createrTime?string("yyyy-MM-dd HH:mm:ss")}</td>
							<td>${w.customerManager!}</td>
							<#if w.currentDealTag?? && tagMap["${w.currentDealTag}"]?? >
								<td>${tagMap["${w.currentDealTag}"]!}</td>
							<#else>
								<td></td>
							</#if>
							<td>${workFormStatus['${w.state}']}</td>
							<td>
								<a href="${ctx}/workform/detail?workFormId=${w.id}&workFormRecordId=${w.lastRecordId!}&title=${title}&url=${url}">详情</a>
							</td>
						</tr>
						</#list>
					</tbody>
				</table>
				<#include "../common/page.htm">
			</div>
		 </form>
	  </div>
	</section>
</div>
<#include "../common/footer.htm">

<script type="text/javascript">
	$('#starTime').datepicker({
		autoclose: true,
		format: 'yyyy-mm-dd',
		clearBtn: true,
	    language: 'zh-CN'
	});
	$('#endTime').datepicker({
		autoclose: true,
		clearBtn: true,
		format: 'yyyy-mm-dd',
	    language: 'zh-CN'
	});
	//查询事件点击校验日期结束日期是否大于开始日期
	$("#query").click(function() {
		$(":input[name='pageNumber']").val(0);
		
		var startTime = $("#starTime").val();
		var endTime = $("#endTime").val();
		if(null != startTime && null != endTime){
			var start = new Date(startTime.replace("-", "/").replace("-", "/")); 
			var end = new Date(endTime.replace("-", "/").replace("-", "/")); 
			if(end < start){
				var title = "提示!";
				base.getView({
					url:"${ctx}/workformlist/prompt",
					success:function(result){
						bootbox.dialog({
							title:title,
							message:result,
							size:"small",
							closeButton : false,
							buttons:{
								cancel:{
									label:"确认",
									className:"btn btn btn-primary"
								}
							}
						})
					}
				})
				$("#endTime").val("");
			}else{
				$("#query").submit();
			}
		}
	});
	
</script>